package com.rdzn.mall.center.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.rdzn.mall.center.entity.SmsCouponHistory;
import com.rdzn.mall.center.mapper.SmsCouponHistoryMapper;
import com.rdzn.mall.center.service.ISmsCouponHistoryService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: sms_coupon_history
 * @Author: jeecg-boot
 * @Date:   2020-08-27
 * @Version: V1.0
 */

@Service
public class SmsCouponHistoryServiceImpl extends ServiceImpl<SmsCouponHistoryMapper, SmsCouponHistory> implements ISmsCouponHistoryService {

    @Override
    public List<SmsCouponHistory> list(Integer memberId, Integer couponId, Integer useStatus) {
        return list(new LambdaQueryWrapper<SmsCouponHistory>()
                .eq(SmsCouponHistory::getId, couponId)
                .eq(SmsCouponHistory::getMemberId, memberId)
                .eq(SmsCouponHistory::getUseStatus, useStatus)
        );
    }

    @Override
    public List<SmsCouponHistory> listByCouponIdAndMemberId(Integer couponId, Integer memberId) {
        return list(new LambdaQueryWrapper<SmsCouponHistory>().eq(SmsCouponHistory::getCouponId, couponId).eq(SmsCouponHistory::getMemberId, memberId));
    }

    @Override
    public List<SmsCouponHistory> listByMemberIdAndUseStatus(Integer memberId, Integer useStatus) {
        return list(new LambdaQueryWrapper<SmsCouponHistory>().eq(SmsCouponHistory::getMemberId, memberId).eq(SmsCouponHistory::getUseStatus, useStatus));
    }

}
